#########################################################
## Mod Title:  Drop Down Smilie MOD Part 1	
## Mod Version: 1.1.7
## Author:       radmanics <radmanics@dial.pipex.com> (David Race) http://members.lycos.co.uk/coolcodesportal/
## Description:  Makes a select, drop down box, which
##		 contains a list of all the smilies
##		 installed on you board. When you select
##		 a smiley, it appears next to the box.
##		 The smiliey code is then inserted to the
##		 like normal (by clicking on it)
## 
## Installation Level:  Easy 
## Installation Time:   5-10 minutes
## Files To Edit:       posting.php
##			privmsg.php
##			language/????/main_lang.php
##			images/smilies/null.gif  (needs to be add, is included)
#########################################################
## Layout Files:	Part 2a
##			Part 2b
##			Part 2c
##			Part 2d
######################################################### 
## Security Disclaimer: This MOD Cannot Be Posted To Or Added At Any Non-Official phpBB Sites 
#########################################################
## Notes: This MOD is inspired (and some of it is modified code) of the UBB
##	  version. It uses the smiliy's name in the select box though.
##	  Be careful not to alter ANY of the javascript unless you know what
##	  you are doing, and have a good reason for it, other wise the MOD wont
##	  work AT ALL!!!! so be careful :)
#########################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
#########################################################



# 
#-----[ OPEN ] -------- 
# 

posting.php 

# 
#-----[ FIND ]---- 
# 

include($phpbb_root_path . 'includes/functions_post.'.$phpEx); 

# 
#---[ ADD AFTER ]---- 
#
 
//this needs to be a relative path and not a global URL (ie: http://phpbb.com/phpBB/images....etc)
$board_root_path = "phpbb/images/smiles/"; //needs trailing slash 

# 
#----- [ FIND ] ---- 
# 

//
// Check and set various parameters
//


# 
#-----[ ADD BEFORE! ] ---- 
# 

//
//Drop Down Smilie List MOD (c) radmanics 2002
//

//user vars
$smilie_path = $smilies_root_path;
$null_path = $smilies_root_path . "null.gif";

$sql = "SELECT DISTINCT emoticon, code, smile_url FROM " . SMILIES_TABLE;
if(!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't obtain smilie data", "", __LINE__, __FILE__, $sql);
}

$num = $db->sql_numrows($result);

$row = $db->sql_fetchrowset($result);

$smilie_data = array();

for ( $k = 0; $k < $num; $k++ )
{
	$smilie_data[$k]['name'] = $row['emoticon'];
	$smilie_data[$k]['url'] = $smilie_path . $row['smile_url'];
	$smilie_data[$k]['code'] = $row['code'];
	$smilie_block .= "<option value='" . $smilie_data[$k]['url'] . "' id=' " .$smilie_data[$k]['code'] ." '>" . $smilie_data[$k]['name'] . "</option>";
}

$temp = $smilie_block;
$smilie_block = "<option value='$nul_path' selected>----Select A Smilie----</option>";
$smilie_block .= $temp;

//end MOD

# 
#-----[ FIND ] ---- 
# 

	'L_STYLES_TIP' => $lang['Styles_tip'],

#
#----- [ ADD AFTER ] -----
#

	'L_SMILIES' => "Smilies",
	'SMILIE_BLOCK' => $smilie_block,
	'SMILIE_NULL' => "http://path/to/phpbb/images/smiles/null.gif",

# 
#-----[ FIND (line 1129) ] ---- 
#

	'S_POST_ACTION' => append_sid("posting.$phpEx"),

#
#----- [ ADD AFTER ] -----
#

	'S_SMILEY_BLOCK' => $smilie_block,
	'S_SMILEY_NULL' => "images/smiles/null.gif",

# 
# --- [ CLOSE posting.php ] ---- 
# 

#
#-----[ OPEN ] ----
#

privmsg.php

# 
#-----[ FIND ]---- 
# 

include($phpbb_root_path . 'includes/functions_post.'.$phpEx); 

# 
#---[ ADD AFTER ]---- 
# 

$board_root_path = "http://www./path/to/phpbb/images/smiles/"; //needs trailing slash 

#
#-----[ FIND ] ----
#

// ----------
// Start main
// 

# 
#-----[ AFTER, ADD ] ---- 
# 

//
//Drop Down Smilie List MOD (c) radmanics 2002
//

//user vars
$smilie_path = $smilies_root_path;
$null_path = $smilies_root_path . "null.gif";

$sql = "SELECT DISTINCT emoticon, code, smile_url FROM " . SMILIES_TABLE;
if(!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't obtain smilie data", "", __LINE__, __FILE__, $sql);
}

$num = $db->sql_numrows($result);

$row = $db->sql_fetchrowset($result);

$smilie_data = array();

for ( $k = 0; $k < $num; $k++ )
{
	$smilie_data[$k]['name'] = $row['emoticon'];
	$smilie_data[$k]['url'] = $smilie_path . $row['smile_url'];
	$smilie_data[$k]['code'] = $row['code'];
	$smilie_block .= "<option value='" . $smilie_data[$k]['url'] . "' id=' " .$smilie_data[$k]['code'] ." '>" . $smilie_data[$k]['name'] . "</option>";
}

$temp = $smilie_block;
$smilie_block = "<option value='$nul_path' selected>----Select A Smilie----</option>";
$smilie_block .= $temp;

//end MOD


#
#-----[ FIND ] ----
#

		'L_STYLES_TIP' => $lang['Styles_tip'],

#
#-----[ ADD AFTER ] ----
#

		'L_SMILIES' => $lang['Smilies'],
		'L_S_CODE_TIP' => $lang['Smiley_tip'],
		'L_SMILEY_CODE' => $lang['Smiley_code'],

#
#-----[ FIND ] ----
#

		'S_POST_ACTION' => append_sid("privmsg.$phpEx"),

#
#-----[ ADD AFTER ] ----
#

		'S_SMILEY_BLOCK' => $smilie_block,
		'S_SMILEY_NULL' => "images/smiles/null.gif",

# 
# --- [ CLOSE posting.php ] ---- 
# 

#
#-----[ OPEN ] ----
#

language/????/lang_main.php

#
#-----[ FIND ] ----
#

//
// That's all Folks!
// -------------------------------------------------

#
#-----[ ADD BEFORE ] ----


//smilies drop down box MOD (c) radmanics 2002
$lang['Smilies'] = "Smilies";
$lang['Smiley_tip'] = "Tip: Use the box to quickly find a smiley, then add it by clicking on the it";
$lang['Smiley_code'] = "The smiley code for this simley is: ";

# 
#------[ SAVE ALL FILES ]------------------------------------- 
# 
# NOW USE Part 2a, 2b, or 2c

